<me:UIVAKDBEZ x:Class="WPFExcelReport.TVA30"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"   
                    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                    xmlns:me="clr-namespace:WPFExcelReport"  
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:GM="clr-namespace:WPFExcelReport;assembly=TGSMATK" 
                     xmlns:GS="clr-namespace:WPFExcelReport;assembly=TGSDAT" 
                    xmlns:V3="clr-namespace:WPFExcelReport;assembly=TVAKOLL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:TXT="clr-namespace:WPFExcelReport;assembly=TTXTIND"
                     xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM"  
                     xmlns:VF="clr-namespace:WPFExcelReport;assembly=TVAFARBEN"  
                     xmlns:VA="clr-namespace:WPFExcelReport;assembly=TVAART"  
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Background="White"    
                    Loaded="Window_Loaded"
     >
    <me:UIVAKDBEZ.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:UPPERGB2312  x:Key="ugb"/>
    </me:UIVAKDBEZ.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <Grid  Grid.Row="0" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"></ColumnDefinition>
                <ColumnDefinition Width="1*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Border Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" 
                BorderBrush="DarkGray" BorderThickness=".0,.0,2,2" CornerRadius="11"  >
                <Border BorderBrush="White" BorderThickness="5" CornerRadius="8" >
                    <Border BorderBrush="Black" BorderThickness="1.5" CornerRadius="8">
                        <GM:TGS04   x:Name="cGS04" 
                        IsAuto="True" 
                        VAR="{Binding VAR,ElementName=cGA}" 
                        ORDERNUM="{Binding KEY,ElementName=TV}"
                        IsManual="{Binding IsManual,ElementName=TV}"
                        IsGSSave="{Binding IsEnabled,ElementName=ZoneEdit}"
                        IsCcopy="{Binding IsCcopy,ElementName=TV}" />
                    </Border>
                </Border>
            </Border>
            <Border Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" 
                BorderBrush="DarkGray" BorderThickness=".0,.0,2,2" CornerRadius="11"  >
                <Border BorderBrush="White" BorderThickness="5" CornerRadius="8" >
                    <Border BorderBrush="Black" BorderThickness="1.5" CornerRadius="8">
                        <StackPanel Name="ZoneEdit" >
                            <WrapPanel>
                                <Button   Click="EditCommand" Height="20" Margin="5,0,0,0" Width="24" ToolTip="{Binding Source={Localization:Translate Word=编辑}}" 
                                          Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                                    <Button.Background>
                                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                                    </Button.Background>
                                </Button>
                                <Button    Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" ToolTip="{Binding Source={Localization:Translate Word=保存}}" 
                                           Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                                    <Button.Background>
                                        <ImageBrush  ImageSource="/ImagePackage;component/Images/save.png" />
                                    </Button.Background>
                                </Button>
                                <Button   Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" Click="ManualColorCommand"  Height="20" Margin="5,0,0,0" Content="{Binding Source={Localization:Translate Word=手工更改色号}}" />
                                <TextBlock  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" Text="仅对确定的色号可以编辑"/>
                            </WrapPanel>
                            <WrapPanel Visibility="{Binding IsXJNew,ElementName=TV,Converter={StaticResource bv}}">
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <KD:TSKD02  Grid.Column="0" KEY="{Binding KUNDNR, ElementName=TV}" 
                                        IsEdit="True"
                                        KEY1="{Binding KDKUNDNA,ElementName=TV}"/>
                                    <TextBlock Grid.Column="1" Visibility="Collapsed" 
                              Text="{Binding KDKUNDNA, ElementName=TV,Converter={StaticResource ResourceKey=gb2312}}" Width="150" />
                                </Grid>
                                <!--/WrapPanel>
                <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}"-->
                                <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=系列:}}"></TextBlock>
                                    <V3:TSVA02 Grid.Column="1" ORDERNUM="{Binding KOLL,ElementName=TV}" />
                                </Grid>
                                <Grid Margin="10,0,0,0" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=颜色类:}}"></TextBlock>
                                    <SD:TSSD0561 Name="cTSSD0561"  Grid.Column="1"  dwKEY="{Binding Path=dwSD561,ElementName=TV}"/>
                                    <Button  Grid.Column="2" Click="GetColorNo" Height="30" Margin="5,0,0,0" Width="30" Name="cGetColorNo" >
                                        <Button.Background>
                                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Reload.png" />
                                        </Button.Background>
                                    </Button>
                                </Grid>
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=色号:}}"></TextBlock>
                                    <ex:TXT72 Grid.Column="1"   CharacterCasing="Upper" MaxLength="10" 
                                                Text="{Binding FARBE,ElementName=TV,Converter={StaticResource ResourceKey=gb2312}}" Width="80" />
                                </Grid>
                                <Button  Grid.Column="3" Click="NewCommand" Height="30" Margin="5,0,0,0" Width="30"  >
                                    <Button.Background>
                                        <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                                    </Button.Background>
                                </Button>
                                <TextBlock Grid.Column="2" Text="必须选择一个客户" Foreground="Red" Visibility="{Binding IsKDFound,ElementName=TV,Converter={StaticResource bv}}"/>

                            </WrapPanel>
                            <WrapPanel Margin="0,5,0,0" IsEnabled="{Binding IsEdit,ElementName=TV}">
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=系列:}}"></TextBlock>
                                    <TextBlock Grid.Column="1"  
                              Text="{Binding VAKBKOLL,Source={StaticResource vwMaster},Converter={StaticResource ResourceKey=gb2312}}" Width="50" />

                                </Grid>
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=客户:}}"></TextBlock>
                                    <TextBlock Grid.Column="1"   
                              Text="{Binding KDKUNDNA,Source={StaticResource vwMaster},Converter={StaticResource ResourceKey=gb2312}}" Width="100" />
                                </Grid>
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=色号:}}"></TextBlock>
                                    <TextBlock Grid.Column="1" Name="txtFARBE"   Background="White"
                              Text="{Binding VAKBFARBE,Source={StaticResource vwMaster},Converter={StaticResource ResourceKey=gb2312}}" Width="120" />
                                </Grid>
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=颜色深浅:}}"></TextBlock>
                                    <TextBlock Grid.Column="1" 
                              Text="{Binding CGRP,ElementName=TV}" Width="60" />
                                    <SD:TSSD0014G Grid.Column="2" 
                                      KEY="{Binding CGRP,ElementName=TV}"
                                      ORDERNUM="{Binding CGRP,ElementName=TV}"
                                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"/>
                                </Grid>
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=RGB:}}"></TextBlock>
                                    <ex:TXT72 Grid.Column="1" MaxLength="3" PRE="000"
                              IsReadOnly="{Binding IsEdit,ElementName=TV}"
                                                Text="{Binding CR,ElementName=TV}" Width="30" />
                                    <ex:TXT72 Grid.Column="2" MaxLength="3" PRE="000"
                                IsReadOnly="{Binding IsEdit,ElementName=TV}"
                                                Text="{Binding CG,ElementName=TV}" Width="30" />
                                    <ex:TXT72 Grid.Column="3" MaxLength="3" PRE="000"
                                IsReadOnly="{Binding IsEdit,ElementName=TV}"
                                                Text="{Binding CB,ElementName=TV}" Width="30" />
                                </Grid>
                            </WrapPanel>
                            <WrapPanel Margin="0,5,0,0" IsEnabled="{Binding IsEdit,ElementName=TV}">
                                <Grid Margin="10,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=客户色号:}}"></TextBlock>
                                    <ex:TXT72 Grid.Column="1" CharacterCasing="Upper"  MaxLength="29"  
                               IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                              Text="{Binding VAKBKDFARBNR,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}" Width="200" />
                                    <TextBlock  Grid.Column="2" Text="{Binding Source={Localization:Translate Word=客户色名:}}"></TextBlock>
                                    <ex:TXT72 Grid.Column="3" CharacterCasing="Upper"  MaxLength="29"  
                                IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                              Text="{Binding VAKBKDARTBEZ,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}" Width="200" />
                                </Grid>
                                <VF:TVAFBEZ  ORDERNUM="{Binding KEY,ElementName=TV}" 
                                VAFBEZ="{Binding VAFBEZ, ElementName=TV}"
                                IsEdit="{Binding IsEdit,ElementName=TV}" IsAutoVAF="True" />
                                <VA:TYVA07 Name="cVA07" ORDERNUM="{Binding KEY,ElementName=TV}" 
                               TBMAT="{Binding TBMAT,ElementName=TV}" 
                               IsAutoVA="True"/>
                            </WrapPanel>
                        </StackPanel>
                    </Border>
                </Border>
            </Border> 
        </Grid>
        
        <xctk:ColorCanvas  Grid.Row="0"  Grid.Column="0" Grid.RowSpan="2" Name="colorpicker" IsEnabled="{Binding IsEdit}"
                           R="{Binding ElementName=TV, Path=CR, Mode=TwoWay}" 
                           G="{Binding ElementName=TV, Path=CG, Mode=TwoWay}" 
                           B="{Binding ElementName=TV, Path=CB, Mode=TwoWay}" Width="250" />
        <Expander IsExpanded="False" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
            <Expander.Header>
                <WrapPanel>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=备注:}}"/>
                    <TextBlock Text="{Binding INFO,Converter={StaticResource gb2312},ElementName=cTxt}"/>
                </WrapPanel>
            </Expander.Header>    
                <TXT:TXTITX 
                    Height="300"
                    Name="cTxt"
                    TART="VAK" 
                    IsInfoOneLine="True"
                    Margin="0,5,0,0" 
                    SIND="{Binding TXTISIND,ElementName=TV}"  
                    IsAuto="{Binding IsEdit,ElementName=TV}"  
                  />
               
         
        </Expander>
        <Expander IsExpanded="False" Grid.Row="2" Grid.Column="1">
            <Expander.Header>
                <WrapPanel>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=同成分色号}}"/>
                    <TextBlock Text="{Binding Counts,ElementName=cGA}"/>
                </WrapPanel>
            </Expander.Header>            
                <GM:TGSVA  x:Name="cGA"
                   CART="{Binding LFD,ElementName=cGS04}"
                   DES="{Binding DES,ElementName=cGS04}" 
                   />          
        </Expander>
    </Grid>
</me:UIVAKDBEZ>
